//
//  LTY_WebViewController.m
//  MooMusic
//
//  Created by 守护神 on 15/10/21.
//  Copyright © 2015年 wjy. All rights reserved.
//

#import "LTY_WebViewController.h"

@interface LTY_WebViewController ()<UIWebViewDelegate>

@property (nonatomic,strong)UIWebView *webView;

@end

@implementation LTY_WebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT)];
    
    //自动对页面进行缩放以适应屏幕
    self.webView.scalesPageToFit = YES;
    // 取消边界回弹
    self.webView.scrollView.bounces = NO;
    // 创建url
    NSURL *url = [NSURL URLWithString:self.webString];
    // 创建NSURLRequest
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    // 加载
    [self.webView loadRequest:request];
    // 设置代理
    self.webView.delegate = self;
    
    [self.view addSubview:self.webView];
    
    NSLog(@"5555555555");
    // Do any additional setup after loading the view.
}

// 当在请求加载中发生错误时 得到的通知
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"加载错误");
    // 重载
    [self.webView reload];
}

// //当网页视图已经开始加载一个请求后，得到通知
- (void)webViewDidStartLoad:(UIWebView *)webView
{
    NSLog(@"开始加载");
}

// 当网页视图结束加载一个请求之后，得到通知
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    NSLog(@"加载结束");
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
